package m.jclecai.com.adapter.KSPagerAdapters;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import java.util.List;

/**
 * Created by hp on 2017/4/28.
 */

public class BettingKSPagerAdapter extends PagerAdapter {


    private final Context context;
    private List<ListView> lvs;

    public BettingKSPagerAdapter(Context context) {
        this.context = context;
    }

    public void setData(List<ListView> lvs) {
        this.lvs = lvs;
    }


    @Override
    public int getCount() {
        return lvs.size();
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        ListView listView = lvs.get(position);
        container.addView(listView);
        return listView;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(lvs.get(position));
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }
}
